import win32gui
import win32api
import win32con
import os
classname = "TfrmMangage.UnicodeClass"
titlename = "考场管理"
#获取句柄
hwnd = win32gui.FindWindow(classname, titlename)
print(hwnd)
clsname='TTntGroupBox.UnicodeClass'

hwnd1= win32gui.FindWindowEx(hwnd, None, clsname, None)
print(hwnd1)

clsname='TTntEdit.UnicodeClass'
hwnd2= win32gui.FindWindowEx(hwnd1, None, clsname, None)
print(hwnd2)

win32api.SendMessage(hwnd2, win32con.WM_SETTEXT, 0, '01010101090154')
win32api.keybd_event(13,0,0,0)
win32api.keybd_event(13,0,win32con.KEYEVENTF_KEYUP,0)